package pers.ree.demo.lambda;

import pers.ree.demo.entity.Student;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class LambdaDebugDemo {
    public static void main(String[] args) {
        List<String> data = new ArrayList<String>();
        data.add("1,Ryan,25,true");
        data.add("2,zhangsan,22,false");
        data.add("3,lisi,18,false");
        data.add("4,wangwu,35,true");
        data.add("5,liliu,20,false");

        Set<String> collect = data.stream().map(d -> {
            String[] split = d.split(",");
            return new Student(split[0], split[1], Integer.parseInt(split[2]), Boolean.parseBoolean(split[3]));
        }).filter(Student::isGraduation)
                .map(Student::getName)
                .collect(Collectors.toSet());

        System.out.println(collect);
    }
}
